package com.example.myapplication.ui

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@Composable
fun PermissionRequestScreen(
    showRationale: Boolean,
    onRequestPermissions: () -> Unit
) {
    androidx.compose.foundation.layout.Box(
        modifier = Modifier.fillMaxSize(),
        contentAlignment = androidx.compose.ui.Alignment.Center
    ) {
        Column(
            horizontalAlignment = androidx.compose.ui.Alignment.CenterHorizontally
        ) {
            Text(
                text = "需要权限才能正常使用应用",
                style = androidx.compose.material3.MaterialTheme.typography.headlineSmall
            )
            
            if (showRationale) {
                Text(
                    text = "应用需要网络权限来加载图片，以及存储权限来保存图片到您的设备。",
                    style = androidx.compose.material3.MaterialTheme.typography.bodyMedium,
                    modifier = Modifier.padding(16.dp)
                )
            }
            
            androidx.compose.material3.Button(
                onClick = onRequestPermissions,
                modifier = Modifier.padding(16.dp)
            ) {
                Text("授予权限")
            }
        }
    }
}
